class Particle(object):
    def __init__(self, r, (x,y) , (vx,vy) ):
        self.r = r
        self.x = x
        self.y = y
        self.vx = vx
        self.vy = vy


    def move(self, dt):
        self.x = self.x + dt * self.vx
        self.y = self.y + dt * self.vy


    def bounce(self, (xmin, xmax, ymin, ymax)):
        if self.x < xmin + self.r:
            self.x = 2 * (xmin + self.r) - self.x
            self.vx = -self.vx

        if self.x > xmax - self.r:
            self.x = 2 * (xmax - self.r) - self.x
            self.vx = -self.vx

        if self.y < ymin + self.r:
            self.y = 2 * (ymin + self.r) - self.y
            self.vy = -self.vy

        if self.y > ymax - self.r:
            self.y = 2 * (ymax - self.r) - self.y
            self.vy = -self.vy

    def draw(self, display):
        display.particle = self
        display.go()

      
